import time
r2l=0
def sort(a):
    swap = True
    while swap:
        swap = False
        for i in range(len(a)-1):
            if a[i] > a[i+1]:
                a[i], a[i+1] = a[i+1], a[i]
                swap = True

def r2l(namefile):
    file = open(namefile, 'r')
    data = file.readlines()
    return data
m1 = r2l('m1_sorted.txt')
m2 = r2l('m2_reverse.txt')
m3 = r2l('m3_shuffle.txt')

 
ts = time.time()
sort(m1)
tf = time.time()
print(round(tf-ts)*1000)

ts = time.time()
sort(m2)
tf = time.time()
print(round(tf-ts)*1000)

ts = time.time()
sort(m3)
tf = time.time()
print(round(tf-ts)*1000)
